#!/bin/bash
# Basic for loop

# names='bar foo 42'
# for name in $names; do
#     echo $name
# done

# for name in bar "foo 42"; do
#     echo $name
# done

## 演示$(command)语法，获取$()中命令的输出结果
for file in $(ls *.sh); do
    echo fileName: "$file"
done

### 演示使用range扩展
# echo
# echo "use range format for loop"
# for value in {1..5}; do
#     echo $value
# done

# echo
# echo "range with step"
# for value in {10..0..2}; do
#     echo $value
# done

echo "All done"
